<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <div id="app">
        <my-header></my-header>
        {{ msg }}
    </div>

    <script type="module">
        import {createApp} from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'

        let app = createApp({           //创建一个Vue应用
            data(){
                return {
                    msg: 'Hello Options API'
                }
            }
        })

        //在应用中创建一个自定义组件：页头
        app.component('MyHeader', {
            template: '<div style="background-color: #dfd; padding:10px">{{title}}</div>',
            data(){
                return {
                    title: '页头内容'
                }
            }
        })
        app.mount('#app')               //把Vue应用挂载DOM树上
    </script>
</body>
</html>